###########################################################
###                    Glare3D GLES2                    ###
###########################################################

# set some CMake module paths
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_CURRENT_SOURCE_DIR})
set (CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/__CMake__)

# enable Folders4CMake
set (folders4cmake_path ${CMAKE_SOURCE_DIR}/__CMake__/folders4cmake.jar)
include (folders4cmake)

# include the source file list generated by Folders4CMake
include (glare.gles2_src_files)

if (ANDROID)
	set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -pedantic -fPIC")
endif ()

set (INCLUDE_DIRS
	${CFG_FILE_DIR}
    ${CMAKE_CURRENT_SOURCE_DIR}/include
    ${CMAKE_SOURCE_DIR}/Libraries/glare.math/include
    ${CMAKE_SOURCE_DIR}/Libraries/glare.core/include
)

if (NOT ANDROID)
	set (INCLUDE_DIRS  ${INCLUDE_DIRS} ${DEPENDENCY_POWER_VR_INCLUDE_DIR})
endif ()

set (LIBRARIES
    glare.core
)

if (WIN32)
	set (LIBRARIES 
		${LIBRARIES}
		libEGL.lib
		libGLESv2.lib
	)
endif ()

include_directories(${INCLUDE_DIRS})

add_library(glare.gles2 STATIC ${file_root})
set_property(TARGET glare.gles2 PROPERTY FOLDER ${PROJECT_LIBRARIES_FOLDER})

auto_rebuild_src_files (glare.gles2)

target_link_libraries(glare.gles2 ${LIBRARIES})
